]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Sort session list by name
authorBalló György <ballogyor@gmail.com>
Fri, 17 Oct 2025 17:42:21 +0000 (19:42 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 20 Oct 2025 20:07:00 +0000 (20:07 +0000)
Instead of sorting the available sessions by their ID, sort them by their
name. This ensures that the list is sorted based on the system locale.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3920>

js/gdm/loginDialog.js

index 26966b633d90618c00b8054251a6eb4fba7d019f..1b568cbde97326fe0e77a681a400b21631733fb5 100644 (file)
@@ -385,17 +385,20 @@ const SessionMenuButton = GObject.registerClass({
 
     _populate() {
         let ids = Gdm.get_session_ids();
-        ids.sort();
 
         if (ids.length <= 1) {
             this._button.hide();
             return;
         }
 
-        for (let i = 0; i < ids.length; i++) {
-            let [sessionName, sessionDescription_] = Gdm.get_session_name_and_description(ids[i]);
+        const sessions = ids.map(id => {
+            const [sessionName] = Gdm.get_session_name_and_description(id);
+            return {id, sessionName};
+        });
+
+        sessions.sort((a, b) => a.sessionName.localeCompare(b.sessionName));
 
-            let id = ids[i];
+        for (const {id, sessionName} of sessions) {
             let item = new PopupMenu.PopupMenuItem(sessionName);
             this._menu.addMenuItem(item);
             this._items.set(id, item);